﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Admin_Asp_UserControls_LoginControl : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void login_Click(object sender, EventArgs e)
    {       
        string f_user = username.Text;
        string f_password = password.Text;

        f_password = Hasher.SHA256(System.Text.Encoding.UTF8.GetBytes(f_password) );

        if (LoginHandler.TryToLogin(f_user, f_password, Session))
        {
            Server.Transfer(Paths.admin_index);
        }
        else
        {
            x_errorPanel.Visible = true;
            x_errorLabel.Text = "Your login information was incorrect";
        }

        
        
    }   

    
}